import requests        #导入requests包
from bs4 import BeautifulSoup
for i in range(1,4):
    url='http://www.dsj365.cn/front/article/22308.html?pageNo='+str(i)+'&sort=desc'
    r = requests.get(url)  # Get方式获取网页数据
    html = r.content.decode("utf-8")
    soup = BeautifulSoup(html, 'lxml')
    # print(soup)
    # x = soup.findAll('strong')
    # print(x)
    soups = soup.select(".content p")
    with open("2019.txt", "a+", encoding='utf-8') as f:
        for soup in soups:
            [s.extract() for s in soup('strong')]
            print(soup.text)
            f.write(soup.text)


# soup = soup.select(".content p")

# x = soup.select(".content p:nth-of-tpe(1)")
#
# for item in x:
#     print(item)
#     print(" ")
# import re
# dr = re.compile(r'<[^>]+>',re.S)
# dd = dr.sub('',soup)
# print(dd)



